{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Introduction to Sampling and Hypothesis Testing\n",
    "\n",
    "## Carbon-14 assignment"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This assignment contains exercises to test your understanding of random variables, confidence intervals and hypothesis testing. It is a good idea to revise the course material thoroughly before starting.\n",
    "\n",
    "Use whatever computational resources you like to answer the questions \n",
    "(e.g. python, R, any other programming language, a spreadsheet, a calculator, ...)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You have been given 500g of wood charcoal and a [Geiger-Müller (G-M) counter](https://en.wikipedia.org/wiki/Geiger_counter). \n",
    "\n",
    "You are using this equipment to investigate the decay of the naturally-occurring radioactive isotope, Carbon-14.\n",
    "\n",
    "You point the G-M tube towards the charcoal.\n",
    "\n",
    "Over six consecutive ten-minute intervals, the detector gives the following counts:\n",
    "10, 21, 19, 15, 26, 17.\n",
    "\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Question 1\n",
    "Based on these observations, calculate the\n",
    "\n",
    "(a) sample mean,\n",
    "\n",
    "(b) sample standard deviation, and\n",
    "\n",
    "(c) standard error of the mean\n",
    "\n",
    "for the number of counts observed in a 10-minute interval."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Question 2\n",
    "\n",
    "(a) Plot the PMF for the number of counts observed in a ten-minute interval. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "(b) What is the probability of observing fewer than 10 counts within a ten-minute interval?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "\n",
    "The G-M tube has a circular window with diameter 5cm.\n",
    "\n",
    "The tube is positioned 10cm from the centre of the charcoal sample.\n",
    "\n",
    "The tube’s detection efficiency for the low-energy beta particles emitted by C-14 is estimated to be 2%.\n",
    "\n",
    "---\n",
    "\n",
    "### Question 3\n",
    "Calculate a 90% confidence interval for the mean number of beta decays occurring in the sample per second."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "\n",
    "The charcoal is estimated to be 80% carbon by weight.\n",
    "\n",
    "A carbon atom has a mass of $2 \\times 10^{-26}$ kg.\n",
    "\n",
    "Approximately 1 in every $10^{12}$ carbon atoms in the atmosphere is C-14.\n",
    "\n",
    "The [half-life](https://en.wikipedia.org/wiki/Half-life) of a radioisotope is the period of time after which its probability of having decayed is 0.5.\n",
    "\n",
    "The half-life, $t_{1/2}$, is given by the formula\n",
    "$$ t_{1/2} = \\tau\\ln (2), $$\n",
    "where $\\tau$ is the *mean lifetime* of the radioisotope.\n",
    "\n",
    "---\n",
    "\n",
    "### Question 4\n",
    "\n",
    "Using your answer to Question 3, calculate a 90% confidence interval for the half-life of Carbon-14."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "\n",
    "The sample is replaced by a new charcoal sample, of the same mass but unknown origin. \n",
    "\n",
    "The G-M counter gives the following counts over six consecutive ten-minute periods: 8, 16, 10, 20, 17, 14.\n",
    "\n",
    "---\n",
    "\n",
    "### Question 5\n",
    "\n",
    "Is this sample older than the first one? Carry out a hypothesis test."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
